home *** CD-ROM | disk | FTP | other *** search
-
-
- NSFShader Normal_Specular_Basic
- {
-
- "This shader skins a model and lights
- it with one directional light + ambient color from light.
- The lighting is done per pixel with specular using a normal map.
- Specular is modulated with a gloss map
- A gloss map IS required to get the shader work correctly"
-
- //The values for the lights. Controllers in the application are
- //responsible for updating these values. Light directions are somewhat
- //misnamed since the represent the light vector from the object not the
- //light direction.
- Global_Attributes
- {
- Attrib_Point4 DirLight1Direction Hidden 0.0, 0.707, 0.707, 1.0
- Attrib_Point4 DirLight1Color Hidden 0.886, 0.886, 0.886, 1.0
- Attrib_Point4 AmbLightColor Hidden 0.886, 0.886, 0.886, 1.0
- Attrib_Point4 CameraWorldLocation Hidden 0.0, 0.0, 0.0, 1.0
- Attrib_Point4 NormalSpecAlpha Hidden 1.0, 1.0, 1.0, 1.0
-
- }
- // Attribute list
- Attributes
- {
- //The texture for the normals.
- Attrib_Texture
- NormalMap
- Artist
- 0
- "NormalMap.tga"
- }
-
-
-
- // Packing Definition
- PackingDef PosBlendWeightBlendIndicesNormUV0
- {
- PD_Stream 0
- PDP_Position 0 PDT_Float3
- PDP_Normal 3 PDT_Float3
- PDP_Binormal 4 PDT_Float3
- PDP_Tangent 5 PDT_Float3
- PDP_TexCoord0 7 PDT_Float2
- }
-
-
- // Implementation
- Implementation VS11_PS11
- {
- "This implementation is intended for hardware
- that supports vertex shader version 1.1 and
- pixel shader 1.1."
-
- // Requirements for this implementation
- Requirements
- {
- VSVersion = v1.1
- UserVersion = v0.0
- PSVersion = v1.1
- BinormalTangentMethod = NBTMethod_ATI
- UsesNIRenderState = true
- Platform = DX8|DX9|XBOX
- }
-
- // Packing Definition it uses
- PackingDef PosBlendWeightBlendIndicesNormUV0
-
- //'Global' render states. Nothing fancy here. We set up Z for
- //safety.
- RenderStates
- {
- AlphaBlendEnable = true
- //SrcBlend = SrcAlpha
- //DestBlend = InvSrcAlpha
- ZEnable = ZB_true
- ZWriteEnable = true
- ZFunc = LessEqual
- SpecularEnable = true
- Lighting = false Save
- }
-
- // First pass
- Pass Pass0
- {
- // Vertex shader program
- VSProgram "Normal_Specular_Basic"
-
- //Vertex Shader constant map. Mostly commented in the vsh file.
- //For double coverage, we'll state here that we could just use
- //ViewProjTranspose since the SkinWorld part is usually identity,
- //but if our assumption fails then at least positions will be
- //correct on screen. Lighting and the warp effect will be off.
- VS_Constantmap
- {
- CM_Defined WorldViewProjTranspose 0 0
- CM_Constant const_1_1_1_255 4 1 1.0,1.0,1.0,765.01
- CM_Global DirLight1Direction 5 1
- CM_Global CameraWorldLocation 6 1
- CM_Constant Half 7 1 0.5,0.5,0.5,0.5
- CM_Defined InvWorldTranspose 8 4
- CM_Constant TexProj 12 1 0.000005,0.000005,1.0,1.0
- CM_Defined WorldTranspose 16 4
- }
-
-
-
-
- // Sampler stage 0
- Sampler 0 BaseMapSampler
- {
- TSS_Texture = NTM_Base
-
- TSAMP_AddressU = TADDR_Wrap
- TSAMP_AddressV = TADDR_Wrap
- TSAMP_AddressW = TADDR_Wrap
- TSAMP_MagFilter = TEXF_Linear
- TSAMP_MinFilter = TEXF_Linear
- TSAMP_MipFilter = TEXF_Linear
- }
-
- // Sampler stage 1
- Sampler 1 NormalMapSampler
- {
- TSS_Texture = <NormalMap>
-
- TSAMP_AddressU = TADDR_Wrap
- TSAMP_AddressV = TADDR_Wrap
- TSAMP_AddressW = TADDR_Wrap
- TSAMP_MagFilter = TEXF_Linear
- TSAMP_MinFilter = TEXF_Linear
- TSAMP_MipFilter = TEXF_Linear
- }
-
- // Sampler stage 2
- Sampler 2 GlossMapSampler
- {
- TSS_Texture = NTM_Gloss
-
- TSAMP_AddressU = TADDR_Wrap
- TSAMP_AddressV = TADDR_Wrap
- TSAMP_AddressW = TADDR_Wrap
- TSAMP_MagFilter = TEXF_Linear
- TSAMP_MinFilter = TEXF_Linear
- TSAMP_MipFilter = TEXF_Linear
- }
-
-
- PSProgram "Normal_Specular_Basic"
-
- PS_Constantmap
- {
- CM_Global AmbLightColor 1 1
- CM_Global DirLight1Color 2 1
- CM_Global NormalSpecAlpha 3 1
- }
- }
- }
- }
-
-